import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/12 10:33
 * @description 二分查找
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] dist = {1,1,100000};
        solution.minSpeedOnTime(dist,  2.01);
    }
    public int minSpeedOnTime(int[] dist, double hour) {
        int l = 1, r = (int) 1e9, ans = -1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (check(dist, mid, hour)) {
                ans = mid;
                r = mid - 1;
            }else {
                l = mid + 1;
            }
        }
        return ans;
    }
    public boolean check(int[] dist, int mid, double hour) {
        double time = 0;
        int n = dist.length;
        for (int i = 0; i < n; i++) {
            if (i != n - 1) {
                time += (dist[i] - 1) / mid  + 1;
            }else {
                time += dist[i] * 1.0 / mid;
            }
            if (time > hour) {
                return false;
            }
        }
        return true;
    }
}
